Skip to content

Conversation

@fmayer
Copy link
Contributor

@fmayer fmayer commented Aug 27, 2024

With this change and appropriate linker changes (https://r.android.com/3236256)
AOSP boots with memtag-global throughout the platform.

Without this change, we would sometimes generate PC-relative references
to tagged globals, which then do not have the proper tag.

Created using spr 1.3.4
@llvmbot
Copy link
Member

llvmbot commented Aug 27, 2024

@llvm/pr-subscribers-backend-aarch64

@llvm/pr-subscribers-llvm-ir

Author: Florian Mayer (fmayer)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/106280.diff

1 Files Affected:

  • (modified) llvm/lib/IR/Globals.cpp (+4)
diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp
index 2bc69cdb712b0a..6b502a08b87d08 100644
--- a/llvm/lib/IR/Globals.cpp
+++ b/llvm/lib/IR/Globals.cpp
@@ -110,6 +110,10 @@ bool GlobalValue::isInterposable() const {
 }
 
 bool GlobalValue::canBenefitFromLocalAlias() const {
+  if (isTagged()) {
+    // Cannot create local aliases to MTE tagged globals.
+    return false;
+  }
   // See AsmPrinter::getSymbolPreferLocal(). For a deduplicate comdat kind,
   // references to a discarded local symbol from outside the group are not
   // allowed, so avoid the local alias.

Created using spr 1.3.4
@fmayer fmayer requested review from eugenis and removed request for eugenis August 29, 2024 21:27
@fmayer fmayer marked this pull request as draft August 29, 2024 21:30
fmayer added a commit to fmayer/llvm-project that referenced this pull request Sep 13, 2024
Created using spr 1.3.4
@fmayer fmayer marked this pull request as ready for review October 8, 2024 18:09
@fmayer fmayer requested a review from eugenis October 8, 2024 18:10
Created using spr 1.3.4
@fmayer fmayer marked this pull request as draft October 9, 2024 17:01
Created using spr 1.3.4
@fmayer fmayer marked this pull request as ready for review October 15, 2024 00:19
Created using spr 1.3.4
Created using spr 1.3.4
@fmayer fmayer merged commit 23b18fa into main Oct 22, 2024
5 of 7 checks passed
@fmayer fmayer deleted the users/fmayer/spr/mte-do-not-allow-local-aliases-to-mte-globals branch October 22, 2024 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants